package com.bruce.dao.impl;

import com.bruce.bean.Admin;
import com.bruce.dao.AdminDao;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * 持久层---数据库访问层
 */
public class AdminDaoImpl extends BaseDao implements AdminDao {

    @Override
    public Admin adminLogin(Admin admin) {
        try {
            return  queryRunner.query("select * from admins where Aname=? and Apassword=?",
                    new BeanHandler<Admin>(Admin.class),admin.getAname(),admin.getApassword());
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

}
